package com.wty.basic.pojo;

import java.util.Objects;

/**
 * 学校类 用于测验深拷贝浅拷贝
 */
public class School implements Cloneable{

    /**
     * 学校名字
     */
    private String name;

    /**
     * 学校人数
     */
    private int num;

    public School() {
    }

    public School(String name, int num) {

        this.name = name;
        this.num = num;
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        School school = (School) o;
        return num == school.num &&
                Objects.equals(name, school.name);
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public int hashCode() {

        return Objects.hash(name, num);
    }
}
